#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Create by zhang
# Create on 2023-03-02 19:16
from enum import IntEnum, Enum


class DateFormat(Enum):
    HM = '%H%M'
    M_S = '%M:%S'
    HMS = '%H%M%S'
    H_M_S = '%H:%M:%S'
    Y_m_d = '%Y-%m-%d'
    Ymd = '%Y%m%d'
    YmdHM = '%Y%m%d%H%M'
    Y_m_d_H_M_S = '%Y-%m-%d %H:%M:%S'
    YmdHMS = '%Y%m%d%H%M%S'


class StockTradeDataType(IntEnum):
    """
    股票交易数据类型
    """
    daily = 1
    minute = 2


class Period(IntEnum):
    """
    策略周期类型
    """
    week = 1
    """周"""
    day = 2
    """日"""
    minute30 = 3
    """30分钟"""
    minute5 = 4
    """5分钟"""
    minute1 = 5
    """1分钟"""


class TradeType(IntEnum):
    """
    下单类型
    """
    SELL = 1
    BUY = 2


class TradeStatus(IntEnum):
    """
    下单类型
    """
    FAIL = 0
    SUCCESS = 1


class EventType(IntEnum):
    """
    事件类型
    """
    TIP_COMMON = 10100
    TIP_LOW = 10101
    TIP_HIGH = 10102

    TRADE_BUY = 10200
    TRADE_SELL = 10201

    TACTIC_MONITOR = 10300
    TACTIC_UNMONITOR = 10301
    TACTIC_INIT = 10302

    DATA_DOWNLOAD = 10400
    DATA_DOWNLOADED = 10401

    TIMER_UPDATED = 10500
    TIME_UPDATED = 10501

    def __str__(self):
        return self.name


class ResultCode(IntEnum):
    ERROR = -2
    FAIL = -1
    SUCESS = 0


class TrendEnum(IntEnum):
    ROSE = 1
    HORIZONTALLY = 0
    FELL = -1


class ThreadName(Enum):
    CONTEXT = "CONTEXT"
    CLOCK = "CLOCK"
    EVENT_MANAGER = "EVENT_MANAGER"
    TRADER = "TRADER"


if __name__ == "__main__":
    p= Period.__dict__
    print()